home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _GCRSPOS.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  57 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef        NDEBUG
  5. char *rcsid__gcrspos = "$Header: c:/curses/private/RCS/_gcrspos.c%v 2.0 1992/11/15 03:24:22 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_get_cursor_pos() - return current cursor position
  14.  
  15.   PDCurses Description:
  16.        This is a private PDCurses function
  17.  
  18.        Gets the cursor position in video page 0.  'row' and 'column'
  19.        are the cursor address.  At this time, there is no support for
  20.        use of multiple screen pages.
  21.  
  22.   PDCurses Return Value:
  23.        This routine will return OK upon success and otherwise ERR will be
  24.        returned.
  25.  
  26.   PDCurses Errors:
  27.        There are no defined errors for this routine.
  28.  
  29.   Portability:
  30.        PDCurses        int     PDC_get_cursor_pos( int* row, int* col );
  31.  
  32. **man-end**********************************************************************/
  33.  
  34. int    PDC_get_cursor_pos(int *row, int *col)
  35. {
  36. #ifdef FLEXOS
  37.        retcode = s_get(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  38.        if (retcode < 0L)
  39.                return( ERR );
  40.        *row = vir.vc_cursor.pos_row;
  41.        *col = vir.vc_cursor.pos_col;
  42.        return( OK );
  43. #endif
  44. #ifdef DOS
  45.        regs.h.ah = 0x03;
  46.        regs.h.bh = _cursvar.video_page;
  47.        int86(0x10, ®s, ®s);
  48.        *row = regs.h.dh;
  49.        *col = regs.h.dl;
  50.        return( OK );
  51. #endif
  52. #ifdef OS2
  53.        VioGetCurPos((PUSHORT)&row,(PUSHORT)&col,0);
  54.        return( OK );
  55. #endif
  56. }
  57.